﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Interfaces; // Brug vores class library "Interfaces"

namespace Model
{
    public class ClsTeamsCollection
    {
        // Attributter
        ClsTeams nytTeam;
        List<ClsTeams> listTeams;

        public ClsTeamsCollection()
        {
            listTeams = new List<ClsTeams>();
        }

        // Opret nyt team i model (instansiere) og lig i listen
        public void DownloadTeamsFraDB(string teamNavn, int teamNummer)
        {
            nytTeam = new ClsTeams(teamNavn,teamNummer);
            listTeams.Add(nytTeam);
        }

        // Metode til at hente liste med interfaceobjekter
        public List<IClsTeams> GetTeams()
        {
            List<IClsTeams> mitTeam = new List<IClsTeams>();

            foreach (var item in listTeams)
            {
                mitTeam.Add((IClsTeams)item);
            }

            return mitTeam;
        }

        public List<ClsTeams> ListTeams
        {
            get { return listTeams; }
        }
    }
}
